package com.qianxun.spider.pipeline;

import com.qianxun.spider.Spider;
import com.qianxun.spider.config.SpiderBeanConfig;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author: huwei
 * @date: 2020/6/29 9:37
 * @version: 1.0.0
 */
@Slf4j
public class ConsoleSpiderPipeline implements SpiderPipeline{
    @Override
    public void process(Map<String, Object> parseMap, Object parseObject, SpiderBeanConfig spiderBeanConfig , Spider spider , Spider.ThreadLocalData localData) {
        System.err.println("current url : " + localData.getCurrentRequestUrl());
        System.err.println("current url domain : " + localData.getCurrentRequestUrlDomain());
        System.err.println("parse original object: " + parseMap);
        System.err.println("switch bean class object: " + parseObject);
        System.err.println("spider config : " + spiderBeanConfig);
    }

    @Override
    public void close(SpiderBeanConfig spiderBeanConfig) {
        System.err.println("spider close：" + spiderBeanConfig);
    }
}
